package com.example.backend.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * 密码策略配置
 */
@Configuration
@ConfigurationProperties(prefix = "security.password")
public class PasswordPolicyConfig {
    
    /**
     * 最小长度
     */
    private int minLength = 6;
    
    /**
     * 最大长度
     */
    private int maxLength = 20;
    
    /**
     * 是否必须包含大写字母
     */
    private boolean requireUppercase = true;
    
    /**
     * 是否必须包含小写字母
     */
    private boolean requireLowercase = true;
    
    /**
     * 是否必须包含数字
     */
    private boolean requireDigit = true;
    
    /**
     * 是否必须包含特殊字符
     */
    private boolean requireSpecialChar = false;
    
    /**
     * 密码历史记录数量（防止重复使用）
     */
    private int historyCount = 5;
    
    /**
     * 密码有效期（天）
     */
    private int expirationDays = 90;
    
    /**
     * 最大登录失败次数
     */
    private int maxFailedAttempts = 5;
    
    /**
     * 账户锁定时间（分钟）
     */
    private int lockoutMinutes = 30;
    
    // Getters and Setters
    public int getMinLength() {
        return minLength;
    }
    
    public void setMinLength(int minLength) {
        this.minLength = minLength;
    }
    
    public int getMaxLength() {
        return maxLength;
    }
    
    public void setMaxLength(int maxLength) {
        this.maxLength = maxLength;
    }
    
    public boolean isRequireUppercase() {
        return requireUppercase;
    }
    
    public void setRequireUppercase(boolean requireUppercase) {
        this.requireUppercase = requireUppercase;
    }
    
    public boolean isRequireLowercase() {
        return requireLowercase;
    }
    
    public void setRequireLowercase(boolean requireLowercase) {
        this.requireLowercase = requireLowercase;
    }
    
    public boolean isRequireDigit() {
        return requireDigit;
    }
    
    public void setRequireDigit(boolean requireDigit) {
        this.requireDigit = requireDigit;
    }
    
    public boolean isRequireSpecialChar() {
        return requireSpecialChar;
    }
    
    public void setRequireSpecialChar(boolean requireSpecialChar) {
        this.requireSpecialChar = requireSpecialChar;
    }
    
    public int getHistoryCount() {
        return historyCount;
    }
    
    public void setHistoryCount(int historyCount) {
        this.historyCount = historyCount;
    }
    
    public int getExpirationDays() {
        return expirationDays;
    }
    
    public void setExpirationDays(int expirationDays) {
        this.expirationDays = expirationDays;
    }
    
    public int getMaxFailedAttempts() {
        return maxFailedAttempts;
    }
    
    public void setMaxFailedAttempts(int maxFailedAttempts) {
        this.maxFailedAttempts = maxFailedAttempts;
    }
    
    public int getLockoutMinutes() {
        return lockoutMinutes;
    }
    
    public void setLockoutMinutes(int lockoutMinutes) {
        this.lockoutMinutes = lockoutMinutes;
    }
}
